//
//  MAMessageDetailCell.m
//  meiang_edu
//
//  Created by Apple on 2018/10/22.
//  Copyright © 2018年 com.meiang.meiang_edu. All rights reserved.
//

#import "MAMessageDetailCell.h"

@implementation MAMessageDetailCell

-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self==[super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self initWithView];
    }
    return self;
}

-(void)initWithView{
    _bgView=[[UIView alloc] initWithFrame:CGRectMake(2, 2, kScreenWidth-4, 100)];
    _bgView.layer.masksToBounds=YES;
    _bgView.layer.cornerRadius=10;
    _bgView.backgroundColor=[UIColor whiteColor];
    [self addSubview:_bgView];
    _photoImageView=[[UIImageView alloc] initWithFrame:CGRectMake(6, 6, 40, 40)];
    [_bgView addSubview:_photoImageView];
    
    CGFloat width=_bgView.frame.size.width;
    _nameLabel=[[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_photoImageView.frame)+6, 6, width-(CGRectGetMaxX(_photoImageView.frame)+6)-36,20)];
    _nameLabel.text=@"张佩佩";
    _nameLabel.textColor=[UIColor colorWithRed:0.200 green:0.200 blue:0.200 alpha:1.00];
    _nameLabel.font=[UIFont boldSystemFontOfSize:18];
    [_bgView addSubview:_nameLabel];
    
    _deleBtn=[UIButton buttonWithType:UIButtonTypeCustom];
    _deleBtn.frame=CGRectMake(width-36, 6, 30, 30);
    [_deleBtn setImage:[UIImage imageNamed:@"closebutton_logo"] forState:UIControlStateNormal];
    [_bgView addSubview:_deleBtn];
    
    _roleLabel=[[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_photoImageView.frame)+6, CGRectGetMaxY(_nameLabel.frame)+10,width-(CGRectGetMaxX(_photoImageView.frame)+6), 20)];
    _roleLabel.text=@"张佩佩的妈妈";
    _roleLabel.textColor=[UIColor colorWithRed:0.200 green:0.200 blue:0.200 alpha:1.00];
    _roleLabel.font=[UIFont systemFontOfSize:14];
    [_bgView addSubview:_roleLabel];
    
    _contentLabel=[[UILabel alloc] initWithFrame:CGRectMake(6, CGRectGetMaxY(_roleLabel.frame)+10,width-12, 20)];
    _contentLabel.text=@"还需要带什么东西吗";
    _contentLabel.textColor=[UIColor colorWithRed:0.200 green:0.200 blue:0.200 alpha:1.00];
    _contentLabel.font=[UIFont systemFontOfSize:14];
    [_bgView addSubview:_contentLabel];
    
    _imageViewBg=[[UIView alloc] initWithFrame:CGRectZero];
    [_bgView addSubview:_imageViewBg];
    
    _timeLabel=[[UILabel alloc] initWithFrame:CGRectMake(6, CGRectGetMaxY(_roleLabel.frame)+10,width-12, 20)];
    _timeLabel.text=@"2018-05-08 16:25";
    _timeLabel.textColor=[UIColor colorWithRed:0.200 green:0.200 blue:0.200 alpha:1.00];
    _timeLabel.font=[UIFont systemFontOfSize:14];
    [_bgView addSubview:_timeLabel];
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
